package practice;

import java.io.*;

public class Demo06缓冲流 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("pic.jpg");
        BufferedInputStream bis = new BufferedInputStream(fis, 1024 * 8);

        FileOutputStream fos = new FileOutputStream("pic2.jpg");
        BufferedOutputStream bos = new BufferedOutputStream(fos, 1024 * 8);
        int t ;
        long start = System.currentTimeMillis();
        while ((t = bis.read()) != -1) {
            bos.write(t);
        }
        System.out.println("复制完毕");
        long end = System.currentTimeMillis();
        System.out.println("时间为:" + (end - start)+"ms");
        bis.close();
        bos.close();
    }
}
